Dynomotion

Group: DynoMotion Message: 2019 From: Kyrylo Perederiy Date: 10/24/2011
Subject: Home switch wiring and homing procedure
Hi,
 
I'm going to use KFLOP for the first time today and I'm totally excited. The plan is to control a 4-axis gantry robot from .NET app. The servo drives are currently set up to take Step/Dir input from an open collector line.
 
My first question is about wiring. I cannot seem to be able to figure out how to wire my Home switches. Should I use JP7 pins 15-18 as TTL inputs for home? My home switch signals are coming from a linear encoder and have 5V TTL levels.
 
Also, should I use JP7 pins 7-14 for 4-axis step/dir signaling? At this point I'm not going to use the encoder feedback.
 
And finally, how do I initiate homing procedure just to test it out for the first time? Can you point me in the right direction please?
 
Thanks in advance,
Kyryl
Group: DynoMotion Message: 2022 From: Tom Kerekes Date: 10/24/2011
Subject: Re: Home switch wiring and homing procedure
Hi Kyryl,
 
Homing is all done in software so you can use any available input.  Those labeled are just the recommended if it otherwise doesn't matter.  If you don't plan on using the encoder inputs on JP7 you might use IO 0-7 (pins 7-14).  Those are 5V tolerant.
 
Step/Dir outputs are hardware generated and come out on fixed pins.  Use IO8-15 (pins 15-22).
 
See:
 
 
 
For homing the simplest example is SimpleHome.c
 
Regards
TK
 
 

Group: DynoMotion Message: 2029 From: Kyrylo Perederiy Date: 10/24/2011
Subject: Re: Home switch wiring and homing procedure
Tom -
 
Thanks a lot for the explanation. I got it all wired up and running. This thing is FAST! Spent two hours trying to figure out why my home program didn't work as I expected and just now found the problem. Your GPIO's are so fast that they were catching transient noise on the line and I had to add a 10nF caps across the inputs.
 
Tomorrow will try to write a C# program that would control the machine.
 
Quick question. Say, I finalized my homing procedure and downloaded a C-program into the controller. Now, how would I call that program from my .NET app? Is this documented somewhere?
 
Thanks,
Kyryl
 
Group: DynoMotion Message: 2030 From: brad murry Date: 10/24/2011
Subject: Re: Home switch wiring and homing procedure
On the c# side, it depends if you are planning to use the core KMotion_dotNet.dll and build your application from scratch up around it or use the MachineManager framework to abstract things like IO, axis, axis group and machine (plus you get a fully customizable WPF/c# gui).
 Ok, shameless plug aside
 
If using the KMotion_dotNet.dll:
 
With an instance of the KM_Controller.cs class, call the CompileAndLoadCoff(int thread, string fullpathto_c_file) and then a WriteLine("Execute<thread>")
 
{
KM_Controller controller = new KM_Controller();
int thread = 1;
controller.CompileAndLoadCoff(thread, @"c:\my machine files\my homing routine.c");
controller.WriteLine(String.Format("Execute{0}", thread));
}
 
 
Alternatively,
 
For single axis ops:
 
Set the Axis.AxisData.HomingScript to the file path(either the .c file or a .py file if you want to run an IronPython script)
Once that is defined and saved, you can just call the Axis.DoHome() method.
 
For homing all, set Machine.MachineData.HomingScript the same way as above and call Machine.HomeAll()
 
 
As a third option, you can create a UserSetting with a DataType of Command.  This will generate a button in the UserSettings panel that you can assign an IronPython script.
 
 
Let me know if you need any additional info, and either way you go I suggest reading the program.cs in the KMotion_dotNet Console project.
 
It goes over much of the core functionality in a single file.
 
-Brad Murry
 
Group: DynoMotion Message: 2033 From: Kyrylo Perederiy Date: 10/25/2011
Subject: Re: Home switch wiring and homing procedure
Excellent! Brad, thanks for your help. I’m going to use KMotion_dotNet.dll for machine control.
 
From: brad murry
Sent: Monday, October 24, 2011 10:37 PM
Subject: RE: [DynoMotion] Home switch wiring and homing procedure
 
 

On the c# side, it depends if you are planning to use the core KMotion_dotNet.dll and build your application from scratch up around it or use the MachineManager framework to abstract things like IO, axis, axis group and machine (plus you get a fully customizable WPF/c# gui).
Ok, shameless plug aside
 
If using the KMotion_dotNet.dll:
 
With an instance of the KM_Controller.cs class, call the CompileAndLoadCoff(int thread, string fullpathto_c_file) and then a WriteLine("Execute<thread>")
 
{
KM_Controller controller = new KM_Controller();
int thread = 1;
controller.CompileAndLoadCoff(thread, @"c:\my machine files\my homing routine.c");
controller.WriteLine(String.Format("Execute{0}", thread));
}
 
 
Alternatively,
 
For single axis ops:
 
Set the Axis.AxisData.HomingScript to the file path(either the .c file or a .py file if you want to run an IronPython script)
Once that is defined and saved, you can just call the Axis.DoHome() method.
 
For homing all, set Machine.MachineData.HomingScript the same way as above and call Machine.HomeAll()
 
 
As a third option, you can create a UserSetting with a DataType of Command.  This will generate a button in the UserSettings panel that you can assign an IronPython script.
 
 
Let me know if you need any additional info, and either way you go I suggest reading the program.cs in the KMotion_dotNet Console project.
 
It goes over much of the core functionality in a single file.
 
-Brad Murry